<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<script>
			var d1=new Date();
			
			d1.setHours(9);
			d1.setMinutes(15);
			d1.setSeconds(30);
			document.write(d1.getFullYear()+"-");
			document.write((d1.getMonth()+1)+"-");
			document.write(d1.getDate()+"&nbsp;");
			document.write(d1.getHours()+":");
			document.write(d1.getMinutes()+":");
			document.write(d1.getSeconds()+".");
			document.write(d1.getMilliseconds());
			
			
			var d2=new Date(2025,0,1);
			//d1.setHours(9);
			//d1.setMinutes(15);
			//d1.setSeconds(30);
			
			var span=d2.getTime()-d1.getTime();
			document.write((span/1000/60/60/24)+"天");
			
			//练习
			
		</script>
		<h2>你活多久了</h2>
		请输入你的生日<input type="text" id="input1" />年
		<input type="text" id="input2" />月
		<input type="text" id="input3" />日
		<button onclick="js">计算</button>
		
		<script>
			var d1=new Date();

			var timeStr=d1.getFullYear()+"-";
			timeStr+=(d1.getMonth()+1)+"-";
			timeStr+=d1.getDate()+"";
			
			var d2=new Date();
			d2.setDate(input3);
			d2.setMonth(input2);
			d2.setFullYear(input3);
			var span=d2.getTime()-d1.getTime();
		    function js(){
				
				document.write((span/1000/60/60/24)+"天");
			}
		</script>
	</body>
</html>
